package cn.xinfei.xdecision.feign;

import feign.Client;
import feign.Request;
import feign.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;
import java.io.IOException;

/**
 * 默认实现，没有连接池
 */
public class FeignDefaultClient extends Client.Default {
    Logger logger = LoggerFactory.getLogger("FeignIPClient");

    /**
     * 默认构造方法
     */
    public FeignDefaultClient() {
        this(null, null);
    }

    /**
     * Null parameters imply platform defaults.
     *
     * @param sslContextFactory
     * @param hostnameVerifier
     */
    public FeignDefaultClient(SSLSocketFactory sslContextFactory, HostnameVerifier hostnameVerifier) {
        super(sslContextFactory, hostnameVerifier);
    }

    @Override
    public Response execute(Request request, Request.Options options) throws IOException {
        //打印目标节点IP
        logger.info("请求至：---> {}", request.url());
        return super.execute(request, options);
    }
}
